#!/usr/bin/perl
#createmod.cgi

require './tgtman-lib.pl';
&ReadParse();
&header($text{'title_add_rule'}, "" , "newrule", 0, 1,);
$tgtname = $in{'tgtname'};

print "<form name='addrule' action=creating.cgi method=post onsubmit='on_form_submit()'>\n";
print "<table class=mode1 width=80%>\n";
print "<tr><td width=150><b>$text{'target_name'}</b></td><td><b>$tgtname</b></td></tr>\n";
print "<tr><td width=150>$text{'ipaddr'}</td><td><input type=text name=ipaddr class=text></td></tr>";
#print "<tr><td width=150>$text{'mask'}</td><td>";
#print "<input type=hidden name=ipaddr2 class=text></td></tr>\n";

print "<tr><td width=150></td><td><input type=checkbox name=allip onclick='return on_allip_check()'>$text{'allip'}</td></tr>\n";
print "<tr><td width=150>$text{'filtertype'}</td><td><select name=ruletype>";
print "<option %s value='DENY'>$text{'deny'}";
print "<option %s value='ALLOW'>$text{'allow'}";

print "</select></td></tr>";


print "</table>\n";

print "<table border=0 class=mode1><tr><td>\n";
print "<input type=submit name=modify value=\"$text{'bt_add'}\" class=button1>\n";
print "<input type=reset name=cancle value=\"$text{'bt_reset'}\" onclick='return on_reset_click()' class=button1>\n";
print "</td></tr></table>\n";

print "<p><input name=tgtname type=hidden value=$tgtname>\n";
print "<p><input name=amark type=hidden value=\"0\"></form>\n";
print <<EOF;
<script>
function on_create_click()
{   
 
}
function on_allip_check()
{
	if(document.addrule.allip.checked){
		document.addrule.ipaddr.disabled=true;
		document.addrule.ipaddr.value="ALL";
		document.addrule.amark.value="1";
		
	}
	else{
		document.addrule.ipaddr.disabled=false;
		document.addrule.ipaddr.value="";
		document.addrule.amark.value="0";
	}
}

function on_form_submit()
{
 
}

function on_reset_click()
{
	document.addrule.ipaddr.disabled=false;
}
</script>
EOF
&footer("javascript:history.back(1)", $text{'back'});
